<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<title>设置支付密码</title>
<link type="text/css" href="../css/reset.css" rel="stylesheet" />
<link type="text/css" href="../css/public.css" rel="stylesheet" />
<link type="text/css" href="../css/wode.css" rel="stylesheet" />
<script>
    var deviceWidth = Math.min(640, window.innerWidth)
    document.documentElement.style.fontSize = deviceWidth / 7.5 + "px"
</script>
<script src="../js/jquery.min.js?v=2.1.4"></script>
<script src="../js/core.js"></script>
<script src="../js/12.7.2shezhizhifumimaadd.js"></script>

</head>

<body style="background: #FFFFFF;">
<!-- top -->
<div class="header">
    <header class="p_header public-red">
        <a href="javascript:history.go(-1);" class="p_header_left">
            <i class="p_left" title="返回"></i>
        </a>
        <h1 class="p_dizhi">设置支付密码</h1>
    </header>
</div>
<!--设置支付密码-->
<form>
    <div class="a_main">
        <h2 id="miamss">设置支付密码</h2>
        <div class="pwd-box">  
            <input type="tel" maxlength="6" class="pwd-input" id="pwd-input">  
            <div class="fake-box">  
                <input type="password" id="password1" readonly>  
                <input type="password" id="password2" readonly>  
                <input type="password" id="password3" readonly>  
                <input type="password" id="password4" readonly>  
                <input type="password" id="password5" readonly>  
                <input type="password" id="password6" readonly>  
            </div>  
        </div> 
    </div>
</form> 
  
<div class="mid-width" id="anniu">
   <a href="#" onclick="baochun()">
        <input type="button" class="p_button"  value="设置密码">
       </a>
</div>



<script type="text/javascript" src="../js/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
	var $input = $(".fake-box input");  
	var pwd="";
        $("#pwd-input").on("input", function() {  
            pwd = $(this).val().trim();  
            for (var i = 0, len = pwd.length; i < len; i++) {  
                $input.eq("" + i + "").val(pwd[i]);  
            }  
            $input.each(function() {  
                var index = $(this).index();  
                if (index >= len) {  
                    $(this).val("");  
                }  
            });  
            if (len == 6) {  
                //执行其他操作  
                
                //alert(pwd);
                
              //  xiayibu(pwd);
                
            }  
        }); 
        
        function baochun(){  //设置密码
        if(pwd.length==6){
        	sessionStorage.setItem("pwd",pwd);
           window.location.href="../add/12.7.3shezhi_mima_queren.html";
        }else{
        	alert("密码未输入完整");
        }
        }
        
        
        function  xiugaisss(){
        	 if(pwd.length==6){
	  		$.ajax({ 
             url: urlcore + "/api/user/setthepassword?password="+pwd+"&userId="+uuuuid+"&type=1",
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					sessionStorage.setItem("xpxd",pwd);
             window.location.href="12.7.3shezhi_mima_queren.html?xid=x";	
				} else {
				  alert("密码不匹配");
				}
			},
			error: function() {
				alert("error");
			}
		});
		  }else{
        	alert("密码未输入完整");
        }
        }

        
        
</script>
</body>
</html>